<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <!--
  基本用法: 
    fetch("http://localhost:9090/first").then(data => {
      return data.text();
    }).then(res =>{
      注意这里才是最终的数据
      console.log(res);
    })

  基于promise来实现的
  语法结构:
    fetch(url).then(f1).then(f2).then(f3).catch(fn);
   -->
</body>
<script>
  fetch("http://localhost:9090/first").then(data => {
    return data.text();
  }).then(data => {
    console.log(data);
  });
</script>

</html>